import random

def zp(n):
  return zip(range(n),random.sample(range(n),n))

def _p(p1,p2):
  return [ (j, p2[p1[j][1]][1]) for j in range(len(p1))]

def i(p):
  _i = [(p[j][1],j) for j in range(len(p)) ]
  _i.sort()
  return _i

def p(*p_):
   _p_ = zip(range(len(p_[0])),range(len(p_[0])))
   for _pp in p_:
     _p_ = _p(_p_,_pp)
   return _p_

def sp(a,p):
   return ''.join([a[p[j][1]] for j in range(len(a))])

